package 并发编程11;

import java.lang.ref.WeakReference;

/**
 * @author idea
 * @data 2019/1/26
 */
public class Demo {


    public static void main(String[] args) {
        WeakReference<String> weakReference=new WeakReference<>(new String("java"));
        String str=new String("str");
        System.out.println(weakReference.get());
        System.gc(); //通知jvm执行gc操作
        System.out.println(weakReference.get());
        System.out.println(str);
    }
}
